<div class="layui-form hisi-search">
    <form action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
            <label class="layui-form-label">电视栏目：</label>
            <div class="layui-input-inline">
                <select name="cid">
                    <option value="0">请选择电视栏目</option>
                    {hisi:loop table="live_category" field="id,name" id="vo"}
                        <option value="{$vo['id']}" <?php if(isset($_GET['id']) && $vo['id'] == $_GET['id']){echo 'selected';} ?> {/if} >{$vo['name']}</option>
                    {/hisi:loop}
                </select>
            </div>
        </div>
        <div class="layui-form-item hisi-search-btn">
            <div class="layui-input-inline">
                <button type="submit" class="layui-btn layui-btn-normal layui-icon layui-icon-search">查询</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-icon layui-icon-delete">重置</button>
            </div>
        </div>
    </form>
</div>

<table id="dataTable"></table>
<script type="text/html" id="usernameTpl">
    <div style="line-height:18px;">
        <img src="{{ d.has_certification ? d.has_certification.man_avatar : '__ADMIN_IMG__/avatar.png' }}" width="60" height="60" class="fl">
        <p class="ml10 fl"><strong class="mcolor">{{ d.has_certification ? d.has_certification.true_name : d.mobile }} </strong><br>手机：{{ d.mobile }}</p>
    </div>
</script>
<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}&hisiModel=live">
</script>
<script type="text/html" id="sortTpl">
    <input type="text" class="layui-input j-ajax-input menu-sort" name="sort" onkeyup="value=value.replace(/[^\d]/g,'')" value="{{ d.sort }}" data-value="{{ d.sort }}" data-href="{:url('sort')}?hisiModel=live&id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}&tpl=live_form&hisiModel=live" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '550px', height: '420px', title: '修改节目'}">修改</a>
    <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    <a href="{:url('add')}?tpl=live_form&id={{ d.id }}" class="layui-btn layui-btn-normal layui-btn-sm hisi-iframe-pop" hisi-data="{width: '550px', height: '420px', title: '添加节目'}">&nbsp;添加</a>
    <a data-href="{:url('status?val=1')}?hisiModel=live" class="layui-btn j-page-btns layui-btn-sm" data-table="table">&nbsp;启用</a>
    <a data-href="{:url('status?val=0')}?hisiModel=live" class="layui-btn layui-btn-warm j-page-btns layui-btn-sm" data-table="table">&nbsp;禁用</a>
    <a data-href="{:url('del')}?hisiModel=live" class="layui-btn layui-btn-danger j-page-btns confirm layui-btn-sm" data-table="table">&nbsp;删除</a>
</script>
<script type="text/javascript">
    layui.use(['jquery', 'laydate', 'table'], function () {
        var $ = layui.jquery, laydate = layui.laydate, table = layui.table;
        table.render({
            elem: '#dataTable'
            , url: '{:url()}' //数据接口
            ,skin: 'row'
            ,even: true
            , page: true //开启分页
            , limit: 15
            , limits: [15, 30, 50, 100, 200]
            , cellMinWidth: 90
            , text: {
                none: '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            , cols: [[ //表头
                { type: 'checkbox' }
                , { field: 'id', title: 'id', width: 100 }
                , { field: 'sort', title: '排序', width: 200, templet: '#sortTpl' }
                , { field: 'cname', title: '栏目', width: 200 }
                , { field: 'title', title: '节目名称', width: 200 }
                , { field: 'status', title: '状态', width: 100, templet: '#statusTpl' }
                , { title: '操作', templet: '#buttonTpl' }
            ]]
            ,done: function(){
                if (typeof(layui.global.addTableTool) !== 'undefined') {
                    layui.global.addTableTool();
                }
            }
        });
    });
</script>